package com.example.webtest.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
 public class WebConfig implements WebMvcConfigurer {
	@Autowired
	tokenintercept tokenintercept;

    //注册拦截器
     @Override
    public void addInterceptors(InterceptorRegistry registry) {
		        //SpringMVC下，拦截器的注册需要排除对静态资源的拦截(*.css,*.js)
		        //SpringBoot已经做好了静态资源的映射，因此我们无需任何操作
	       registry.addInterceptor(tokenintercept).addPathPatterns("/test");
   }
}

